<?php 
/*
	Template Name: Index
*/
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>

<head profile="http://gmpg.org/xfn/11">
	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

	<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>

	<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->
	<link href="<?php bloginfo('template_url'); ?>/style.css" rel="stylesheet" type="text/css" />  
	<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/mediabox.css" type="text/css" media="screen" />

    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/imagelink.js"></script>
	<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/mootools.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/mediabox68.js"></script>
	<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/swfobject.js"></script>
    
    <!--[if IE]><link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/ie-style.css" type="text/css" media="screen"></link><![endif]-->

	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
	<?php wp_head(); ?>
</head>

<body>
	<div id="wrapper">
    	<div id="head_content">
        <div id="menu">
			<a href="<?php bloginfo('url'); ?>"><span class="menu-items"><h3>Home</h3>Take me back to the home page</span></a>
            
			<?php
            $pages = wp_list_pages('exclude=1423&sort_column=menu_order&depth=1&title_li=&echo=0');
            $pages = preg_replace('/(<a[^>]*>)/','$1<span class="menu-items"><h3>',$pages);
            $pages = str_replace('</a>', '</h3>Click here for more information</span></a>', $pages);
            echo $pages;
            ?>          

            <span class="search"><h3>Search</h3><?php include (TEMPLATEPATH . '/searchform.php'); ?></span>
        </div>            
		</div>
<!-- end header -->

<div id="items">
	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <div class="item">
       <?php if (is_category()): ?>
        <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h2>
        <?php else: ?>
         <div class="background"></div> 
        <a href="<?php $key="videolink"; echo get_post_meta($post->ID, $key, true); ?>" rel="mediabox[<?php $key="videowidth"; echo get_post_meta($post->ID, $key, true); ?> <?php $key="videoheight"; echo get_post_meta($post->ID, $key, true); ?>]" Title="Click here to instantly play this video"><?php the_excerpt(); ?></a>      
        
        <div class="content">
        <h2><a href="<?php the_permalink(); ?>"><?php the_title() ?></a></h2>
        <p><?php the_content(''); ?> </p>
        </div>
        <div class="comments-link">
        <p><a href="<?php the_permalink() ?>#comments" title="Commenti a questo articolo"><?php comments_number('0', '1', '%'); ?></a></p>
        </div>
      <?php endif; ?>
        </div>
    <?php endwhile; else: ?>
    <?php endif; ?>
    <div id="navi"><?php next_posts_link('<span class="navforward"></span>') ?><?php previous_posts_link('<span class="navback"></span>') ?></div>
</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>